#include <bits/stdc++.h>
using namespace std;
#define int long long
void solve()
{
    int n;
    cin>>n;
    vector<pair<int,int>> v(n+1);
    int xx=LONG_LONG_MAX,dx=0,xy=LONG_LONG_MAX,dy=0;
    int cxx=LONG_LONG_MAX,cdx=0,cxy=LONG_LONG_MAX,cdy=0;
    int a[8];
    for(int i=1;i<=n;i++)
    {
        cin>>v[i].first>>v[i].second;
        if(xx>=v[i].first-1)
        {
            cxx=xx;a[4]=a[0];
            xx=v[i].first-1;a[0]=i;
        }
        if(dx<=v[i].first)
        {
            cdx=dx;a[5]=a[1];
            dx=v[i].first;a[1]=i;
        }
        if(xy>=v[i].second-1)
        {
            cxy=xy;a[6]=a[2];
            xy=v[i].second-1;a[2]=i;
        }
        if(dy<=v[i].second)
        {
            cdy=dy;a[7]=a[3];
            dy=v[i].second;a[3]=i;
        }
    }
    int f=0,x,y;
    int ans=LONG_LONG_MAX;
    for(int i=1;i<=n;i++)
    {
        x=(dx-xx),y=(dy-xy);
        if(a[0]==i)x=(dx-cxx);
        if(a[1]==i)x=(cdx-xx);
        if(a[2]==i)y=(dy-cxy);
        if(a[3]==i)y=(cdy-xy);
        if(x!=(dx-xx)||y!=(dy-xy))
        {
            ans=min(ans,x*y);
        }
    }
    cout<<ans<<endl;
}
signed main()
{
    //ios::sync_with_stdio(false);
    //cin.tie(nullptr);
    int T=1;
    cin>>T;
    while(T--)
    {
       solve();
    }
    return 0;
}